<template>
	<view class="select">
		<view class="title">
			请选择您的职业
		</view>

		<view class="selectBox">
			<view class="itemBox" @click="handleSelect(0)">
				<image class="" src="@/static/image/salesman.png" style="width: 320rpx;height: 320rpx;" />
				<view class="text">
					业务经理
				</view>
			</view>
			<view class="itemBox" @click="handleSelect(1)">
				<image class="" src="@/static/image/lovespecialist.png" style="width: 320rpx;height: 320rpx;" />
				<view class="text">
					爱心专员
				</view>
			</view>
			<view class="itemBox" @click="handleSelect(2)">
				<image class="" src="@/static/image/driver.png" style="width: 320rpx;height: 320rpx;" />
				<view class="text">
					司机
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {

			}
		},
		onLoad() {
			this.handleLogin()
		},
		onShow() {
			this.handleLogin()
		},
		methods: {
			handleLogin() {
				if (uni.getStorageSync("token")) {
					if (uni.getStorageSync("identity") == 0 || uni.getStorageSync("identity") == 1) {
						uni.redirectTo({
							url: "/pages/home/index"
						})
					} else {
						uni.redirectTo({
							url: "/pages/home/driverList"
						})
					}
				}
			},
			handleSelect(value) {
				uni.setStorageSync('identity', value)
				uni.navigateTo({
					url: "/pages/login/index"
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.select {
		.title {
			width: 100%;
			font-size: 64rpx;
			font-family: PingFang SC-Semibold, PingFang SC;
			font-weight: 600;
			color: #000000;
			line-height: 50rpx;
			margin-top: 48rpx;
			text-align: center;
		}

		.selectBox {

			.itemBox {
				display: flex;
				flex-direction: column;
				align-items: center;
				margin-top: 48rpx;
				position: relative;

				.text {
					font-size: 64rpx;
					font-family: PingFang SC-Semibold, PingFang SC;
					font-weight: 600;
					color: #FFFFFF;
					line-height: 50rpx;
					position: absolute;
					bottom: 50rpx;

				}
			}
		}
	}
</style>